import time

def sortirovka(a):
    f=True
    while f:
        f=False
        for i in range(len(a)-1):
            if a[i]>a[i+1]:
                a[i],a[i+1]=a[i+1],a[i]
                f=True
m1=list(map(int,open('m1_sorted.txt').read().splitlines()))
m2=list(map(int,open('m2_reverse.txt').read().splitlines()))
m3=list(map(int,open('m3_shuffle.txt').read().splitlines()))
t0=time.time()
sortirovka(m1)
t=time.time()
print("m1_sorted",round((t-t0)*1000),"milliseconds")
t0=time.time()
sortirovka(m2)
t=time.time()
print("m2_reverse",round((t-t0)*1000),"milliseconds")
t0=time.time()
sortirovka(m3)
t=time.time()
print("m3_shuffle",round((t-t0)*1000),"milliseconds")
